import request from '@/utils/request'
import { Attrbiute, AttributeOperateResponse, AttributeResponse } from './type'

export const getAttributes = (cid: number) => {
  return request.get<any, AttributeResponse>('/attribute', {
    params: {
      cid,
    },
  })
}

export const addAttributes = (attributeInfo: Attrbiute) => {
  return request.post<any, AttributeOperateResponse>(
    '/attribute/add',
    attributeInfo,
  )
}

export const updateAttributes = (attributeInfo: Attrbiute) => {
  return request.put<any, AttributeOperateResponse>(
    '/attribute/update',
    attributeInfo,
  )
}

export const deleteAttrbites = (id: number) => {
  return request.delete<any, AttributeOperateResponse>('/attribute/delete', {
    params: {
      id,
    },
  })
}
